<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: Dean <zxxjjforever@163.com>
// +----------------------------------------------------------------------
namespace api\doctor\controller;

use think\Db;
use cmf\controller\RestBaseController;
use think\Config;
use think\Cache;
use \Qcloud\sms\SmsSingleSender AS sms;

class CommonController extends RestBaseController
{

    /**
     * [megimg 聊天图文]
     * @return [type] [description]
     */
    public function megimg(){
        $file = request()->file('image');
        if($file){  
            $info = $file->move(ROOT_PATH . 'public' . DS . 'upload' . DS . 'message');
            if($info){
                if( !in_array($info->getExtension(), ['png','jpg'])){
                    $this->error('图片上传失败，只能上传jpg、png格式图片');
                }
                $this->success('上传成功！',Config::get('weburl').'/upload'. DS .'message'. DS.$info->getSaveName());
            }else{
                $this->error('没有检测到上传的图片!');
            }
        }else{
            $this->error('没有检测到上传的图片！');
        }
    }   
    
}
 